const   http = require('http');
const fs= require('fs');
// console.log(http);
const server = http.createServer((req, res) => {
    res.setHeader('Content-Type', 'text/html; charset=utf-8'); // 设置响应头为UTF-8编码
    fs.readFile('../Html第4天/flex01.html', (err, data) => {
        if (err) {
            res.writeHead(404, {'Content-Type': 'text/plain'});
            res.end('Not Found');
        } else {
             res.end(data);
             }
    })

});
server.listen(3000, () => {
    console.log('Server running at http://localhost:3000/');
        });